package com.devbobcorn.misaka.client;

import com.devbobcorn.misaka.Misaka;
import com.devbobcorn.misaka.entities.ModEntityType;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.SpriteRenderer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

// Client-Side Only Things...
@EventBusSubscriber(modid = Misaka.MODID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public final class ClientModEventSubscriber {
	private static final Logger LOGGER = LogManager.getLogger("Client Mod Event Subscriber");

	@SubscribeEvent
	public static void onClientSetupEvent(FMLClientSetupEvent event) {
		LOGGER.info("Client Side Setup.");

		RenderingRegistry.registerEntityRenderingHandler(ModEntityType.COIN_TYPE, (EntityRendererManager manager) -> {
			return new SpriteRenderer<>(manager, Minecraft.getInstance().getItemRenderer());
		});

		LOGGER.info("Entities Renderers Bound.");
	}
}
